From 2a2926808c0db2dbecb12c8fe533bcbe79e5710b Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 20 Mar 2006 18:36:35 +0100 Subject: [PATCH] Some more build-system finessing: 1. subdirs-y -> subdir-y (match Linux name, and also obj-y is singular so this makes sense). 2. subdirs can be declared with or without trailing slash 3. As with Linux, subdirs can be declared in the obj-y list but they must be distinguished by a trailing slash Signed-off-by: Keir Fraser --- xen/Post.mk | 15 ++++++++++++--- xen/arch/x86/Makefile | 12 ++++++------ xen/arch/x86/cpu/Makefile | 4 ++-- xen/arch/x86/hvm/Makefile | 4 ++-- xen/arch/x86/hvm/svm/Makefile | 4 ++-- xen/arch/x86/hvm/vmx/Makefile | 4 ++-- xen/drivers/Makefile | 4 ++-- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/xen/Post.mk b/xen/Post.mk index cc05380016..02008ac7b0 100644 --- a/xen/Post.mk +++ b/xen/Post.mk @@ -1,7 +1,16 @@ +# Ensure each subdirectory has exactly one trailing slash. +subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n))) +subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y))) -subdirs-all := $(subdirs-y) $(subdirs-n) +# Add explicitly declared subdirectories to the object list. +obj-y += $(patsubst %,%/built_in.o,$(subdir-y)) -obj-y += $(patsubst %,%/built_in.o,$(subdirs-y)) +# Add implicitly declared subdirectories (in the object list) to the +# subdirectory list, and rewrite the object-list entry. +subdir-y += $(filter %/,$(obj-y)) +obj-y := $(patsubst %/,%/built-in.o,$(obj-y)) + +subdir-all := $(subdir-y) $(subdir-n) built_in.o: $(obj-y) $(LD) $(LDFLAGS) -r -o $@ $^ @@ -12,7 +21,7 @@ FORCE: %/built_in.o: FORCE $(MAKE) -C $* -clean:: $(addprefix _clean_, $(subdirs-all)) FORCE +clean:: $(addprefix _clean_, $(subdir-all)) FORCE rm -f *.o *~ core _clean_%/: FORCE $(MAKE) -C $* clean diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 014e5f31d8..3fa20dd7d0 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -1,12 +1,12 @@ include $(BASEDIR)/Rules.mk -subdirs-y += acpi -subdirs-y += cpu -subdirs-y += genapic -subdirs-y += hvm +subdir-y += acpi +subdir-y += cpu +subdir-y += genapic +subdir-y += hvm -subdirs-$(x86_32) += x86_32 -subdirs-$(x86_64) += x86_64 +subdir-$(x86_32) += x86_32 +subdir-$(x86_64) += x86_64 obj-y += apic.o obj-y += audit.o diff --git a/xen/arch/x86/cpu/Makefile b/xen/arch/x86/cpu/Makefile index 437f68fb2f..bbb02cb719 100644 --- a/xen/arch/x86/cpu/Makefile +++ b/xen/arch/x86/cpu/Makefile @@ -1,7 +1,7 @@ include $(BASEDIR)/Rules.mk -subdirs-y += mcheck -subdirs-y += mtrr +subdir-y += mcheck +subdir-y += mtrr obj-y += amd.o obj-y += common.o diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile index c9aefe1c48..84759742b6 100644 --- a/xen/arch/x86/hvm/Makefile +++ b/xen/arch/x86/hvm/Makefile @@ -1,7 +1,7 @@ include $(BASEDIR)/Rules.mk -subdirs-y += svm -subdirs-y += vmx +subdir-y += svm +subdir-y += vmx obj-y += hvm.o obj-y += i8259.o diff --git a/xen/arch/x86/hvm/svm/Makefile b/xen/arch/x86/hvm/svm/Makefile index 442d526ea2..3e26b45e18 100644 --- a/xen/arch/x86/hvm/svm/Makefile +++ b/xen/arch/x86/hvm/svm/Makefile @@ -1,7 +1,7 @@ include $(BASEDIR)/Rules.mk -subdirs-$(x86_32) += x86_32 -subdirs-$(x86_64) += x86_64 +subdir-$(x86_32) += x86_32 +subdir-$(x86_64) += x86_64 obj-y += emulate.o obj-y += instrlen.o diff --git a/xen/arch/x86/hvm/vmx/Makefile b/xen/arch/x86/hvm/vmx/Makefile index 6b0f548eb3..221e8aa694 100644 --- a/xen/arch/x86/hvm/vmx/Makefile +++ b/xen/arch/x86/hvm/vmx/Makefile @@ -1,7 +1,7 @@ include $(BASEDIR)/Rules.mk -subdirs-$(x86_32) += x86_32 -subdirs-$(x86_64) += x86_64 +subdir-$(x86_32) += x86_32 +subdir-$(x86_64) += x86_64 obj-y += io.o obj-y += vmcs.o diff --git a/xen/drivers/Makefile b/xen/drivers/Makefile index e118e2115a..b24da03f5e 100644 --- a/xen/drivers/Makefile +++ b/xen/drivers/Makefile @@ -1,6 +1,6 @@ include $(BASEDIR)/Rules.mk -subdirs-y := char/ -subdirs-$(HAS_ACPI) += acpi/ +subdir-y += char +subdir-$(HAS_ACPI) += acpi include $(BASEDIR)/Post.mk -- 2.30.2